/*Social Network Variables*/
gen CentDif = abs(Cent1-Cent2)
label var CentDif "Difference in centrality (prestige) scores"
gen CentMax = max(Cent1,Cent2)
label var CentMax "Maximum of centrality (prestige) scores"
gen EVCentDif = abs(EVCent1-EVCent2)
label var EVCentDif "Difference in Eigenvalue centrality scores"
gen ClusSame=1 if Clus1==Clus2
replace ClusSame=0 if ClusSame==.
label var ClusSame "In same cluster when clustering by absolute distance w/2-10 clusters"
gen H6ClusSame=1 if H6Clus1==H6Clus2
replace H6ClusSame=0 if H6ClusSame==.
label var H6ClusSame "In same cluster when clustering by absolute distance w/6 clusters"
gen ENClusSame=1 if ENClus1==ENClus2
replace ENClusSame=0 if ENClusSame==.
label var ENClusSame "In same cluster when clustering by Euclidean distance w/2-10 clusters"
gen ClusSizeMax=max(ClusSize1,ClusSize2)
label var ClusSizeMax "Maximum Cluster Size when clustering by absolute distance w/2-10 clusters"
gen H6ClusSizeMax=max(ClusSize1,ClusSize2)
label var H6ClusSizeMax "Maximum Cluster Size when clustering by absolute distance w/6 clusters"
gen ENClusSizeMax=max(ENClusSize1,ENClusSize2)
label var ENClusSizeMax "Maximum Cluster Size when clustering by absolute distance w/6 clusters"

/*Democracy*/
gen smldmat=demauta if demauta<=demautb & demautb~=.
replace smldmat=demautb if demautb<demauta & demauta~=.
label var smldmat "Democracy (lower)"

/*Dependency*/
gen smldep=dependa if dependa<=dependb & dependb~=.
replace smldep=dependb if dependb<dependa & dependa~=.
label var smldep "Dependency (lower)"

/*Major powers*/
gen majpower=1 if (statea==2 | stateb==2) & (year>1898)
replace majpower=1 if (statea==200 | stateb==200)
replace majpower=1 if (statea==220 | stateb==220) & ((year<1941) | (year>1944))
replace majpower=1 if (statea==255 | stateb==255) & ((year<1919) | (year>1924 & year<1946) | year>1990)
replace majpower=1 if (statea==300 | stateb==300) & (year<1919)
replace majpower=1 if (statea==325 | stateb==325) & (year>1859 & year<1944)
replace majpower=1 if (statea==365 | stateb==365) & ((year<1918) | (year>1922))
replace majpower=1 if (statea==710 | stateb==710) & (year>1949)
replace majpower=1 if (statea==740 | stateb==740) & ((year>1894 & year<1946) | year>1990)
replace majpower=0 if majpower==.
label var majpower "Major Power in dyad"

/*Dyad ID*/
gen dyadid=(1000*statea)+stateb
label var dyadid "Dyad ID"
iis dyadid
tis year

